import request from '@/utils/request'
import MODULE from '@/utils/module'
export function getList(data, currentPage, pageSize) {
    return request({
        url: MODULE.MODULE.goodsType +'/GoodsType/list/' + pageSize + '/' + currentPage,
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
            data = JSON.stringify(data)
            return data
        }],
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export function doDelete(data) {
    return request({
        url: MODULE.MODULE.goodsType + '/GoodsType/remove',
        method: 'delete',
        data: data,
        params: { },
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
            data = JSON.stringify(data)
            return data
        }],
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

// 编辑
export function doEdit(data) {
    return request({
        url: MODULE.MODULE.goodsType + '/GoodsType/edit',
        method: 'PATCH',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
                data = JSON.stringify(data)
                return data
            }],
        headers: {
        'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

export function getOriginOrganTypeAndAssigned(data, currentPage, pageSize) {
    return request({
        url: MODULE.MODULE.goodsType +'/GoodsType/list?pageSize=' + pageSize + '&pageNum=' + currentPage,
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
            data = JSON.stringify(data)
            return data
        }],
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}



export function getGoodsTypeTree(data) {
    return request({
        url: MODULE.MODULE.goodsType +'/GoodsType/getGoodsTypeTree',
        method: 'post',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
            data = JSON.stringify(data)
            return data
        }],
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}


//指派给组织
export function assignee2Organ(data) {
    return request({
        url: MODULE.MODULE.goodsType +'/GoodsType/assign2Organs',
        method: 'put',
        params: {},
        data: data,
        transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
            data = JSON.stringify(data)
            return data
        }],
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}



// 查询已分配到的组织
export function queryAlreadyAssignedOrgans(data) {
  return request({
    url: MODULE.MODULE.goodsType + '/GoodsTypeOrgan/queryAlreadyAssignedOrgans',
    method: 'POST',
    params: {},
    data: data,
    transformRequest: [function(data) { // 在请求之前对data传参进行格式转换
      data = JSON.stringify(data)
      return data
    }],
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}



